﻿<ResourceDictionary 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  >
  <Style x:Key="RefreshButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type Button}">
          <Border 
            x:Name="bd" 
            BorderBrush="LightGray" 
            BorderThickness="1" 
            CornerRadius="45" 
            Padding="4"  
            SnapsToDevicePixels="True"  
            ToolTip="Refresh values"
            >
            <Border.Effect>
              <DropShadowEffect Opacity="0.2"  />
            </Border.Effect>
            <Viewbox 
              x:Name="refreshArrow" 
              Margin="-3,-4,0,0"
              RenderTransformOrigin="0.6,0.6"
              Width="28" Height="30"
              >
              <Viewbox.RenderTransform>
                <RotateTransform Angle="0" />
              </Viewbox.RenderTransform>
              <Grid>
                <Ellipse HorizontalAlignment="Left" Margin="12,10,0,0" VerticalAlignment="Top" Width="49" Height="45" StrokeThickness="8">
                  <Ellipse.Stroke>
                    <LinearGradientBrush StartPoint="0.1,0.1" EndPoint="0.5,0.8">
                      <GradientStop Color="#19FFFFFF" Offset="0.009"/>
                      <GradientStop Color="#FF9E9E9E" Offset="0.366"/>
                      <GradientStop Color="#FF000000" Offset="0.888"/>
                    </LinearGradientBrush>
                  </Ellipse.Stroke>
                </Ellipse>
                <Path RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="10.231,24.199,0,0" VerticalAlignment="Top" Width="28.522" Height="17.156" Fill="#FFFFFFFF" Stretch="Fill" StrokeThickness="8" Data="M103.22397,151.20347 L123.56373,163.75175">
                  <Path.Stroke>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                      <GradientStop Color="#FF000000" Offset="0.723"/>
                      <GradientStop Color="#FFFFFFFF" Offset="0.897"/>
                    </LinearGradientBrush>
                  </Path.Stroke>
                  <Path.RenderTransform>
                    <TransformGroup>
                      <ScaleTransform ScaleX="1" ScaleY="1"/>
                      <SkewTransform AngleX="0" AngleY="0"/>
                      <RotateTransform Angle="8.23"/>
                      <TranslateTransform X="-0.78427860658800519" Y="-0.034769015785228063"/>
                    </TransformGroup>
                  </Path.RenderTransform>
                </Path>
                <Path RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="2.52,22.072,0,0" VerticalAlignment="Top" Width="17.307" Height="26.496" Fill="#FFFFFFFF" Stretch="Fill" StrokeThickness="8" Data="M80.230341,161.63048 L70.898465,177.88329">
                  <Path.Stroke>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                      <GradientStop Color="#FF000000" Offset="0.723"/>
                      <GradientStop Color="#FFFFFFFF" Offset="1"/>
                    </LinearGradientBrush>
                  </Path.Stroke>
                  <Path.RenderTransform>
                    <TransformGroup>
                      <ScaleTransform ScaleX="1" ScaleY="1"/>
                      <SkewTransform AngleX="0" AngleY="0"/>
                      <RotateTransform Angle="15.68"/>
                      <TranslateTransform X="-0.37571048112769212" Y="1.0065849089983097"/>
                    </TransformGroup>
                  </Path.RenderTransform>
                </Path>
              </Grid>
            </Viewbox>
          </Border>
          <ControlTemplate.Triggers>
            <Trigger Property="IsPressed" Value="True">
              <Setter TargetName="bd" Property="Effect">
                <Setter.Value>
                  <DropShadowEffect Opacity="0.4" />
                </Setter.Value>
              </Setter>
              <Setter TargetName="bd" Property="RenderTransform">
                <Setter.Value>
                  <TranslateTransform X="1" Y="1" />
                </Setter.Value>
              </Setter>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
              <Setter TargetName="bd" Property="Background" Value="#11000000" />
            </Trigger>
            
            <EventTrigger RoutedEvent="Button.Click">
              <EventTrigger.Actions>
                <BeginStoryboard>
                  <Storyboard>
                    <DoubleAnimation 
                      Storyboard.TargetName="refreshArrow"
                      Storyboard.TargetProperty="RenderTransform.(RotateTransform.Angle)"
                      From="0" To="360"
                      Duration="0:0:0.5"
                      />
                  </Storyboard>
                </BeginStoryboard>
              </EventTrigger.Actions>
            </EventTrigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
</ResourceDictionary>